package com.ws.genercity.demo03;

import java.util.ArrayList;

/**
 * @author 13353
 */
public class MainClass {
    public static void main(String[] args) {
        ProductGetter<String> stringProductGetter = new ProductGetter<>();
        String[] strs = {"1000元现金","苹果手机","食用油","汽车","e"};
        //给抽奖器填充奖品
        for (String str : strs) {
            stringProductGetter.addProduct(str);
        }
        //抽奖
        String product = stringProductGetter.getProduct();
        System.out.println(product);

        //使用泛型方法
        ProductGetter<Integer> integerProductGetter = new ProductGetter<>();
        ArrayList<Integer> intergerList = new ArrayList<>();
        intergerList.add(1);
        intergerList.add(2);
        Integer product1 = integerProductGetter.getProduct1(intergerList);
        System.out.println(product1);

        ArrayList<String> strings = new ArrayList<>();
        strings.add("3");
        strings.add("4");
        System.out.println(integerProductGetter.getProduct(strings));

        //调用多个泛型类型的静态泛型方法
        ProductGetter.printType(100,"java",true);

        //调用可变参数的泛型方法
        ProductGetter.print(1,"javav",true,"abc");

    }
}
